package com.example.spring.service;

import java.util.List;

import org.hibernate.HibernateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.spring.dao.ContactDAO;
import com.example.spring.form.Contact;

@Service
public class ContactServiceImpl implements ContactService{

	@Autowired
	ContactDAO contactDAO ;
	
	@Override
	@Transactional
	public void addContact(Contact contact) throws HibernateException{
		contactDAO.addContact(contact);
	}

	@Override
	@Transactional
	public List<Contact> listContact() {
		return contactDAO.listContact();
	}

	@Override
	@Transactional
	public void removeContact(Integer id) {
		contactDAO.removeContact(id);
	}

}
